package cloud.xlh.exceptionhandle.service;


import cloud.xlh.exceptionhandle.exception.BaseException;
import cloud.xlh.exceptionhandle.exception.BusinessException;

import java.text.MessageFormat;

/**
 * Created with IntelliJ IDEA.
 *
 * @ project name : xlh_osms
 * @ Author: XuLeHuang
 * @ Date: 2022/12/8 11:42
 * @ Description: 业务异常断言
 */
public interface BusinessExceptionAssert extends IResponseEnum, Assert {

    @Override
    default BaseException newException(Object... args) {
        String msg = MessageFormat.format(this.getMessage(), args);
        return new BusinessException(this, args, msg);
    }

    @Override
    default BaseException newException(Throwable t, Object... args) {
        String msg = MessageFormat.format(this.getMessage(), args);
        return new BusinessException(this, args, msg, t);
    }
}

